import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../../models/menu_item_model.dart';

class MenuItemWidget extends StatelessWidget {
  final MenuItemModel item;
  final VoidCallback onTap;

  const MenuItemWidget({super.key, required this.item, required this.onTap});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Card(
        elevation: 4,
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            // 图标
            Container(
              width: 50,
              height: 50,
              decoration: BoxDecoration(
                color: item.color.withValues(alpha: 0.1),
                borderRadius: BorderRadius.circular(12),
              ),
              child: Icon(item.icon, size: 32, color: item.color),
            ),
            const SizedBox(height: 12),
            // 标题
            Text(
              item.title,
              style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
              textAlign: TextAlign.center,
            ),
          ],
        ),
      ),
    );
  }
}
